<?php
namespace Amis\feedback;

use Amis\Basics\AmisBasics;

class Alert extends AmisBasics
{
    public string $type = 'alert';

    public function className($className)
    {
        $this->className = $className;
        return $this;
    }

    /**
     * 级别，可以是：info、success、warning 或者 danger
     * @param string $level
     * @return $this
     */
    public function level($level = 'info')
    {
        if (in_array($level, ['info', 'success', 'warning', 'danger'])) {
            $this->level = $level;
        }
        return $this;
    }

    public function body($body)
    {
        $this->body = $body;
        return $this;
    }

    /**
     * 是否显示关闭按钮
     * @param bool $showCloseButton
     * @return $this
     */
    public function showCloseButton(bool $showCloseButton = false)
    {
        $this->showCloseButton = $showCloseButton;
        return $this;
    }

    /**
     * 关闭按钮的 CSS 类名
     * @param string $closeButtonClassName
     * @return $this
     */
    public function closeButtonClassName(string $closeButtonClassName)
    {
        $this->closeButtonClassName = $closeButtonClassName;
        return $this;
    }

    public function showIcon(bool $showIcon = false)
    {
        $this->showIcon = $showIcon;
        return $this;
    }

    public function icon($icon)
    {
        $this->icon = $icon;
        return $this;
    }

    /**
     * icon 的 CSS 类名
     * @param string $iconClassName
     * @return $this
     */
    public function iconClassName(string $iconClassName)
    {
        $this->iconClassName = $iconClassName;
        return $this;
    }
}